<template>
  <div>
    <el-card class="box-card">
      <div slot="header" class="clearfix">
        <span>变更管理</span>
        <el-button style="float: right; padding: 3px 0" type="text" @click="goToDetail('application', '', 'application')" v-if="$route.query.projectStatus < 7">申请变更</el-button>
      </div>
      <el-table style="width: 100%" :data="tableData">
        <el-table-column type="index" align="center"></el-table-column>
        <el-table-column prop="requestDescribe" label="原因描述" align="center"></el-table-column>
        <!-- <el-table-column prop="man" label="审批人" align="center"></el-table-column> -->
        <el-table-column prop="approveText" label="状态" align="center"></el-table-column>
        <el-table-column prop="startTime" label="时间" align="center"></el-table-column>
        <el-table-column label="操作" align="center">
          <template slot-scope="scope">
            <el-button size="mini" @click="goToDetail('appliced', scope.row, 'detail' )">详情</el-button>
          </template>
        </el-table-column>
      </el-table>
    </el-card>
  </div>
</template>
<script>
export default {
  data() {
    return {
      tableData: []
    };
  },
  methods: {
    goToDetail(flag, row, from) {
      this.$router.push({path: '/project/alterationDetail', query: {id: this.$route.query.id, flag: flag,from: from, name: this.$route.query.name, approveId: row.id}})
    },
    getAlteration() {
      let params = {
        bizId: this.$route.query.id,
        bizType: $conf.bizType['alteration']
      };
      this.$store.dispatch('common/pageApproveRequest', params).then(res => {
        this.tableData = res.records.map(item => {
          item.approveText = $status.alterationText[item.approveStatus]
          return item;
        })
      })
    }
  },
  mounted() {
    this.getAlteration();
  }
};
</script>
<style lang="less" scoped>
</style>